![]() |
PATH![]() |
![]() ![]() |
Navigation Services notifies you before displaying items in the following areas:
You can take advantage of this notification process by creating a
filter function, described in this document as MyFilterProc
, to determine which items are displayed. Register your filter function by passing a Universal Procedure Pointer (UPP) in the
filterProc
parameter of a Navigation Services function such as NavGetFile
. You obtain this UPP by calling the macro
NewNavObjectFilterProc
and passing a pointer to your filter function. When calling your filter function, Navigation Services provides detailed information on HFS files and folders via a structure of type NavFileOrFolderInfo
. Your filter function specifies which file objects to display to the user by returning
true
for each object you wish to display and
false
for each object you do not wish to display. If your filter function does not recognize an object, it should return
true
and allow the object to be displayed.
IMPORTANT
Your filter function must not assume that the data passed in
theItem
parameter is a'typeFSS'
Apple event descriptor. If you intend to use the data passed in thetheItem
parameter, you must first determine its Apple event descriptor type by attempting to coerce the data into a type that you expect or support. If theAEDesc
structure cannot be coerced into a valid file specification, for example, the data passed in theinfo
parameter does not refer to an HFS file object. For more information on working withAEDesc
structures, see Inside Macintosh: Interapplication Communication.
Listing 7 illustrates a sample filter function that allows only text files to be displayed.
Listing 7 A sample filter function
pascal Boolean myFilterProc(AEDesc* theItem, void* info,
NavCallBackUserData callBackUD,
NavFilterModes filterMode)
{
OSErr theErr = noErr;
Boolean display = true;
NavFileOrFolderInfo* theInfo = (NavFileOrFolderInfo*)info;
if (theItem->descriptorType == typeFSS)
if (!theInfo->isFolder)
if (theInfo->fileAndFolder.fileInfo.finderInfo.fdType
!= 'TEXT')
display = false;
return display;
}
IMPORTANT
Navigation Services expects your filter function to return true if an object is to be displayed. This is the opposite of what Standard File expects from file filter functions.
For more information on object filtering options, see Filtering File Objects.
Previous | Back Up One Level | Next |
|
Copyright © 1998 Apple Computer, Inc. All rights reserved. |